
;
;
;     Model statements for module:  Create 9
;

250$          CREATE,        1,HoursToBaseTime(0.0),Entity 1:HoursToBaseTime(24):NEXT(251$);

251$          ASSIGN:        Create 9.NumberOut=Create 9.NumberOut + 1:NEXT(87$);


;
;
;     Model statements for module:  Assign 64
;
87$           ASSIGN:        day=day+1:NEXT(88$);


;
;
;     Model statements for module:  Dispose 17
;
88$           ASSIGN:        Dispose 17.NumberOut=Dispose 17.NumberOut + 1;
254$          DISPOSE:       Yes;


113$          CREATE,        1,TFIN:,1:NEXT(114$);

114$          WRITE,         rqueueoutput:
                             
                             tavg(time in receiptq at d1),tavg(time in receiptq at d2),davg(statistic 1),davg(statistic 2),davg(statistic 3),dmax(statistic 1), dmax(statistic 2),dmax(statistic 3),davg(statistic 4),davg(statistic 5),davg(statistic 6),dmax(statistic 4),dmax(statistic 5),dmax(statistic 6),davg(statistic 7),dmax(statistic 7),davg(statistic 8),dmax(statistic 8);
115$          DISPOSE:       No;


122$          CREATE,        1,TFIN:,1:NEXT(123$);

123$          WRITE,         rtimeinsystem:
                             
                             tavg(time in system from d1), tavg(time in system from d2),tavg(time for putaway from d1),tavg(time for putaway from d2);
124$          DISPOSE:       No;


127$          CREATE,        1,TFIN::NEXT(128$);

128$          WRITE,         utilizationf1:
                             FSTAND(forklift1,1),FSTAND(forklift1,2),FSTAND(forklift1,4);
129$          DISPOSE:       No;


130$          CREATE,        1,TFIN::NEXT(131$);

131$          WRITE,         utilizationf2:
                             FSTAND(forklift2,1),FSTAND(forklift2,2),FSTAND(forklift2,4);
132$          DISPOSE:       No;


133$          CREATE,        1,TFIN::NEXT(134$);

134$          WRITE,         utilizationf3:
                             FSTAND(forklift3,1),FSTAND(forklift3,2),FSTAND(forklift3,4);
135$          DISPOSE:       No;


136$          CREATE,        1,TFIN::NEXT(137$);

137$          WRITE,         utilizationf4:
                             FSTAND(forklift4,1),FSTAND(forklift4,2),FSTAND(forklift4,4);
138$          DISPOSE:       No;


139$          CREATE,        1,TFIN::NEXT(140$);

140$          WRITE,         utilizationf5:
                             FSTAND(forklift5,1),FSTAND(forklift5,2),FSTAND(forklift5,4);
141$          DISPOSE:       No;


142$          CREATE,        1,TFIN::NEXT(143$);

143$          WRITE,         utilizationf6:
                             FSTAND(forklift6,1),FSTAND(forklift6,2),FSTAND(forklift6,4);
144$          DISPOSE:       No;


145$          CREATE,        1,TFIN::NEXT(146$);

146$          WRITE,         utilizationd1:
                             FSTAND(dock 1,1),FSTAND(dock 1,2),FSTAND(dock 1,4);
147$          DISPOSE:       No;


148$          CREATE,        1,TFIN::NEXT(149$);

149$          WRITE,         utilizationd2:
                             FSTAND(dock 2,1),FSTAND(dock 2,2),FSTAND(dock 2,4);
150$          DISPOSE:       No;


162$          CREATE,        1,TFIN:,1:NEXT(163$);

163$          WRITE,         squeueoutput:
                             
                             tavg(time in shipmentq at d1),tavg(time in shipmentq at d2),nc(dispatchatruck),nc(dispatchbtruck),nc(dispatchctruck),nc(#runaway),tavg(time for pickup to d1),tavg(time for pickup to d2),tavg(time for loading at d1),tavg(time for loading at d2);
164$          DISPOSE:       No;


169$          CREATE,        1,TFIN:,1:NEXT(170$);

170$          WRITE,         stimeinsystem:
                             
                             tavg(time in system from d1 for shipment),nc(# of trucks that are in system  more than 60 minutes from d1),nc(#of trucks that are from d1),tavg(time in system from d2 for shipment),nc(# of trucks that are in system  more than 60 minutes from d2),nc(#of trucks that are from d2),nc(# of trucks that are in system  more than 45 minutes from d1),nc(# of trucks that are in system  more than 45 minutes from d2);
171$          DISPOSE:       No;


;
;
;     Model statements for module:  Create 114
;

255$          CREATE,        1,NSEXPO(schedule for receipt arrivals),receipt:NSEXPO(schedule for receipt arrivals):NEXT(256$);

256$          ASSIGN:        Create 114.NumberOut=Create 114.NumberOut + 1:NEXT(234$);


;
;
;     Model statements for module:  Assign 200
;
234$          ASSIGN:        producttype=disc(0.6,1,0.9,2,1,3):NEXT(117$);


;
;
;     Model statements for module:  Decide 121
;
117$          BRANCH,        1:
                             If,producttype==1,116$,Yes:
                             If,producttype==2,118$,Yes:
                             Else,119$,Yes;
119$          COUNT:         receiptctruck,1:NEXT(110$);


;
;
;     Model statements for module:  Assign 78
;
110$          ASSIGN:        receiptqenter=tnow:NEXT(108$);

108$          QUEUE,         receiptdockqueue;
100$          SEIZE,         2,Other:
                             SELECT(Docks,LRC,index),1:NEXT(101$);


;
;
;     Model statements for module:  Decide 116
;
101$          BRANCH,        1:
                             If,docks(index)==dock1,261$,Yes:
                             Else,262$,Yes;
261$          ASSIGN:        Decide 116.NumberOut True=Decide 116.NumberOut True + 1:NEXT(111$);

262$          ASSIGN:        Decide 116.NumberOut False=Decide 116.NumberOut False + 1:NEXT(176$);

111$          TALLY:         time in receiptq at d1,tnow-receiptqenter,1:NEXT(0$);


;
;
;     Model statements for module:  Assign 2
;
0$            ASSIGN:        truckcap=8:
                             dockno=1:NEXT(1$);

1$            DUPLICATE:     truckcap-1,68$:NEXT(68$);


;
;
;     Model statements for module:  Process 1
;
68$           ASSIGN:        Process 1.NumberIn=Process 1.NumberIn + 1:
                             Process 1.WIP=Process 1.WIP+1;
292$          STACK,         1:Save:NEXT(266$);

266$          QUEUE,         Process 1.Queue;
265$          SEIZE,         1,VA:
                             SELECT(TransSet4,SNB, ),1:NEXT(264$);

264$          DELAY:         SecondsToBaseTime(UNIF(62,83,61)),,VA:NEXT(307$);

307$          ASSIGN:        Process 1.WaitTime=Process 1.WaitTime + Diff.WaitTime;
271$          TALLY:         Process 1.WaitTimePerEntity,Diff.WaitTime,1;
273$          TALLY:         Process 1.TotalTimePerEntity,Diff.StartTime,1;
297$          ASSIGN:        Process 1.VATime=Process 1.VATime + Diff.VATime;
298$          TALLY:         Process 1.VATimePerEntity,Diff.VATime,1;
263$          RELEASE:       SELECT(TransSet4,LAST),1;
312$          STACK,         1:Destroy:NEXT(311$);

311$          ASSIGN:        Process 1.NumberOut=Process 1.NumberOut + 1:
                             Process 1.WIP=Process 1.WIP-1:NEXT(178$);


;
;
;     Model statements for module:  Assign 110
;
178$          ASSIGN:        beginning time for putaway from d1=tnow:NEXT(104$);

104$          ASSIGN:        product3stock=(producttype==3)*(product3stock+1)+(producttype<>3)*(product3stock+0):
                             product2stock=(producttype==2)*(product2stock+1)+(producttype<>2)*(product2stock+0):
                             product1stock=(producttype==1)*(product1stock+1)+(producttype<>1)*(product1stock+0):NEXT(2$);


;
;
;     Model statements for module:  Assign 3
;
2$            ASSIGN:        i=1:NEXT(3$);


;
;
;     Model statements for module:  Assign 4
;
3$            ASSIGN:        replaced=0:NEXT(4$);

4$            WHILE:         (replaced==0):NEXT(7$);


;
;
;     Model statements for module:  Decide 3
;
7$            BRANCH,        1:
                             If,(LocationA(i,1) == 0) ||  ( (producttype  ==  LocationA (i,2)) && (LocationA(i,1) < Capacity) ),
                             314$,Yes:
                             Else,315$,Yes;
314$          ASSIGN:        Decide 3.NumberOut True=Decide 3.NumberOut True + 1:NEXT(6$);

315$          ASSIGN:        Decide 3.NumberOut False=Decide 3.NumberOut False + 1:NEXT(9$);

6$            ASSIGN:        LocationA(i,1)=LocationA(i,1)+1:
                             LocationA(i,2)=producttype:NEXT(10$);


;
;
;     Model statements for module:  Assign 11
;
10$           ASSIGN:        Locationtype=1:NEXT(56$);


;
;
;     Model statements for module:  Decide 45
;
56$           BRANCH,        1:
                             If,dockno==1,316$,Yes:
                             Else,317$,Yes;
316$          ASSIGN:        Decide 45.NumberOut True=Decide 45.NumberOut True + 1:NEXT(201$);

317$          ASSIGN:        Decide 45.NumberOut False=Decide 45.NumberOut False + 1:NEXT(200$);


;
;
;     Model statements for module:  Assign 183
;
201$          ASSIGN:        width1=
                             (LocationA(i,1)==1)*4+(LocationA(i,1)==2)*3+(LocationA(i,1)==3)*2+(LocationA(i,1)==4)*1+(LocationA(i,1)==5)*0:
                             distance1=20+i*1+width1:NEXT(12$);


;
;
;     Model statements for module:  Assign 13
;
12$           ASSIGN:        replaced=1:NEXT(13$);

13$           ENDWHILE:NEXT(53$);


;
;
;     Model statements for module:  Decide 44
;
53$           BRANCH,        1:
                             If,dockno==1,318$,Yes:
                             Else,319$,Yes;
318$          ASSIGN:        Decide 44.NumberOut True=Decide 44.NumberOut True + 1:NEXT(15$);

319$          ASSIGN:        Decide 44.NumberOut False=Decide 44.NumberOut False + 1:NEXT(54$);


;
;
;     Model statements for module:  Seize 2
;
15$           QUEUE,         Seize 2.Queue;
              SEIZE,         2,Other:
                             SELECT(TransSet1,CYC, trans_no1),1:NEXT(321$);

321$          DELAY:         0.0,,VA:NEXT(220$);


;
;
;     Model statements for module:  Decide 229
;
220$          BRANCH,        1:
                             If,stock exceeded<>1,322$,Yes:
                             Else,323$,Yes;
322$          ASSIGN:        Decide 229.NumberOut True=Decide 229.NumberOut True + 1:NEXT(17$);

323$          ASSIGN:        Decide 229.NumberOut False=Decide 229.NumberOut False + 1:NEXT(221$);


;
;
;     Model statements for module:  Delay 1
;
17$           DELAY:         
                             SecondsToBaseTime((Locationtype==1)*((34.521+(0.915*distance1)+NORM(0,7.3))*2)+(Locationtype==2)*((34.521+(0.915*distance3)+NORM(0,7.3))*2)+(Locationtype==3)*((34.521+(0.915*distance5)+NORM(0,7.3))*2)+(Locationtype==4)*((34.521+(0.915*distance7)+NORM(0,7.3))*2)),,
                             Other:NEXT(18$);

18$           RELEASE:       Member(TransSet1, Trans_No1),1;
180$          TALLY:         time for putaway from d1,tnow-beginning time for putaway from d1,1;
151$          ASSIGN:        #unloaded1=#unloaded1+1:NEXT(19$);


;
;
;     Model statements for module:  Decide 6
;
19$           BRANCH,        1:
                             If,#unloaded1==truckcap,324$,Yes:
                             Else,325$,Yes;
324$          ASSIGN:        Decide 6.NumberOut True=Decide 6.NumberOut True + 1:NEXT(20$);

325$          ASSIGN:        Decide 6.NumberOut False=Decide 6.NumberOut False + 1:NEXT(14$);


;
;
;     Model statements for module:  Release 1
;
20$           RELEASE:       dock1,1:NEXT(121$);

121$          TALLY:         time in system from d1,tnow-receiptqenter,1;
152$          ASSIGN:        #unloaded1=#unloaded1-#unloaded1:NEXT(14$);


;
;
;     Model statements for module:  Dispose 1
;
14$           ASSIGN:        Dispose 1.NumberOut=Dispose 1.NumberOut + 1;
326$          DISPOSE:       Yes;


;
;
;     Model statements for module:  Delay 14
;
221$          DELAY:         SecondsToBaseTime(((34.521+(0.915*averagedistance)+Norm(0,7.3))*2)),,Other:NEXT(18$);


;
;
;     Model statements for module:  Seize 15
;
54$           QUEUE,         Seize 15.Queue;
              SEIZE,         2,Other:
                             SELECT(TransSet2,CYC, trans_no2),1:NEXT(328$);

328$          DELAY:         0.0,,VA:NEXT(223$);


;
;
;     Model statements for module:  Decide 230
;
223$          BRANCH,        1:
                             If,stock exceeded<>1,329$,Yes:
                             Else,330$,Yes;
329$          ASSIGN:        Decide 230.NumberOut True=Decide 230.NumberOut True + 1:NEXT(57$);

330$          ASSIGN:        Decide 230.NumberOut False=Decide 230.NumberOut False + 1:NEXT(222$);


;
;
;     Model statements for module:  Delay 11
;
57$           DELAY:         
                             SecondsToBaseTime((Locationtype==1)*((34.521+(0.915*distance2)+NORM(0,7.3))*2)+(Locationtype==2)*((34.521+(0.915*distance4)+NORM(0,7.3))*2)+(Locationtype==3)*((34.521+(0.915*distance6)+NORM(0,7.3))*2)+(Locationtype==4)*((34.521+(0.915*distance8)+NORM(0,7.3))*2)),,
                             Other:NEXT(58$);

58$           RELEASE:       Member(TransSet2, Trans_No2),1;
181$          TALLY:         time for putaway from d2,tnow-beginning time for putaway from d1,1;
153$          ASSIGN:        #unloaded2=#unloaded2+1:NEXT(60$);


;
;
;     Model statements for module:  Decide 56
;
60$           BRANCH,        1:
                             If,#unloaded2==truckcap,331$,Yes:
                             Else,332$,Yes;
331$          ASSIGN:        Decide 56.NumberOut True=Decide 56.NumberOut True + 1:NEXT(61$);

332$          ASSIGN:        Decide 56.NumberOut False=Decide 56.NumberOut False + 1:NEXT(59$);


;
;
;     Model statements for module:  Release 15
;
61$           RELEASE:       dock2,1:NEXT(120$);

120$          TALLY:         time in system from d2,tnow-receiptqenter,1;
154$          ASSIGN:        #unloaded2=#unloaded2-#unloaded2:NEXT(59$);


;
;
;     Model statements for module:  Dispose 15
;
59$           ASSIGN:        Dispose 15.NumberOut=Dispose 15.NumberOut + 1;
333$          DISPOSE:       Yes;


;
;
;     Model statements for module:  Delay 15
;
222$          DELAY:         SecondsToBaseTime(((34.521+(0.915*averagedistance)+Norm(0,7.3))*2)),,Other:NEXT(58$);


;
;
;     Model statements for module:  Assign 182
;
200$          ASSIGN:        width2=
                             (LocationA(i,1)==1)*4+(LocationA(i,1)==2)*3+(LocationA(i,1)==3)*2+(LocationA(i,1)==4)*1+(LocationA(i,1)==5)*0:
                             distance2=23+i*1+width2:NEXT(12$);


;
;
;     Model statements for module:  Decide 4
;
9$            BRANCH,        1:
                             If,
                             ((LocationB(i,1) == 0) ||  ( (producttype  ==  LocationB (i,2)) && (LocationB(i,1) < Capacity) )),
                             334$,Yes:
                             Else,335$,Yes;
334$          ASSIGN:        Decide 4.NumberOut True=Decide 4.NumberOut True + 1:NEXT(5$);

335$          ASSIGN:        Decide 4.NumberOut False=Decide 4.NumberOut False + 1:NEXT(70$);

5$            ASSIGN:        LocationB(i,1)=LocationB(i,1)+1:
                             LocationB(i,2)=producttype:NEXT(11$);


;
;
;     Model statements for module:  Assign 12
;
11$           ASSIGN:        Locationtype=2:NEXT(202$);


;
;
;     Model statements for module:  Decide 223
;
202$          BRANCH,        1:
                             If,dockno==1,336$,Yes:
                             Else,337$,Yes;
336$          ASSIGN:        Decide 223.NumberOut True=Decide 223.NumberOut True + 1:NEXT(203$);

337$          ASSIGN:        Decide 223.NumberOut False=Decide 223.NumberOut False + 1:NEXT(204$);


;
;
;     Model statements for module:  Assign 184
;
203$          ASSIGN:        width3=
                             (LocationB(i,1)==1)*4+(LocationB(i,1)==2)*3+(LocationB(i,1)==3)*2+(LocationB(i,1)==4)*1+(LocationB(i,1)==5)*0:
                             distance3=20+i*1+width3:NEXT(12$);


;
;
;     Model statements for module:  Assign 186
;
204$          ASSIGN:        width4=
                             (LocationB(i,1)==1)*4+(LocationB(i,1)==2)*3+(LocationB(i,1)==3)*2+(LocationB(i,1)==4)*1+(LocationB(i,1)==5)*0:
                             distance4=23+i*1+width4:NEXT(12$);


;
;
;     Model statements for module:  Decide 67
;
70$           BRANCH,        1:
                             If,((LocationC(i,1) == 0) ||  ( (producttype  ==  LocationC (i,2)) && (LocationC(i,1) < 8) )),338$,
                             Yes:
                             Else,339$,Yes;
338$          ASSIGN:        Decide 67.NumberOut True=Decide 67.NumberOut True + 1:NEXT(71$);

339$          ASSIGN:        Decide 67.NumberOut False=Decide 67.NumberOut False + 1:NEXT(89$);

71$           ASSIGN:        LocationC(i,1)=LocationC(i,1)+1:
                             LocationC(i,2)=producttype:NEXT(72$);


;
;
;     Model statements for module:  Assign 49
;
72$           ASSIGN:        Locationtype=3:NEXT(73$);


;
;
;     Model statements for module:  Decide 68
;
73$           BRANCH,        1:
                             If,dockno==1,340$,Yes:
                             Else,341$,Yes;
340$          ASSIGN:        Decide 68.NumberOut True=Decide 68.NumberOut True + 1:NEXT(74$);

341$          ASSIGN:        Decide 68.NumberOut False=Decide 68.NumberOut False + 1:NEXT(75$);


;
;
;     Model statements for module:  Assign 51
;
74$           ASSIGN:        width5=
                             (LocationC(i,1)==1)*7+(LocationC(i,1)==2)*6+(LocationC(i,1)==3)*5+(LocationC(i,1)==4)*4+(LocationC(i,1)==5)*3+(LocationC(i,1)==6)*2+(LocationC(i,1)==7)*1+(LocationC(i,1)==8)*0:
                             distance5=13+i*1+width5:NEXT(12$);


;
;
;     Model statements for module:  Assign 52
;
75$           ASSIGN:        width6=
                             (LocationC(i,1)==1)*7+(LocationC(i,1)==2)*6+(LocationC(i,1)==3)*5+(LocationC(i,1)==4)*4+(LocationC(i,1)==5)*3+(LocationC(i,1)==6)*2+(LocationC(i,1)==7)*1+(LocationC(i,1)==8)*0:
                             distance6=14+i*1+width6:NEXT(12$);


;
;
;     Model statements for module:  Decide 110
;
89$           BRANCH,        1:
                             If,((LocationD(i,1) == 0) ||  ( (producttype  ==  LocationD (i,2)) && (LocationD(i,1) < 8) )),342$,
                             Yes:
                             Else,343$,Yes;
342$          ASSIGN:        Decide 110.NumberOut True=Decide 110.NumberOut True + 1:NEXT(90$);

343$          ASSIGN:        Decide 110.NumberOut False=Decide 110.NumberOut False + 1:NEXT(8$);

90$           ASSIGN:        LocationD(i,1)=LocationD(i,1)+1:
                             LocationD(i,2)=producttype:NEXT(91$);


;
;
;     Model statements for module:  Assign 76
;
91$           ASSIGN:        Locationtype=4:NEXT(205$);


;
;
;     Model statements for module:  Decide 224
;
205$          BRANCH,        1:
                             If,dockno==1,344$,Yes:
                             Else,345$,Yes;
344$          ASSIGN:        Decide 224.NumberOut True=Decide 224.NumberOut True + 1:NEXT(206$);

345$          ASSIGN:        Decide 224.NumberOut False=Decide 224.NumberOut False + 1:NEXT(207$);


;
;
;     Model statements for module:  Assign 189
;
206$          ASSIGN:        width7=
                             (LocationD(i,1)==1)*7+(LocationD(i,1)==2)*6+(LocationD(i,1)==3)*5+(LocationD(i,1)==4)*4+(LocationD(i,1)==5)*3+(LocationD(i,1)==6)*2+(LocationD(i,1)==7)*1+(LocationD(i,1)==8)*0:
                             distance7=13+i*1+width7:NEXT(12$);


;
;
;     Model statements for module:  Assign 190
;
207$          ASSIGN:        width8=
                             (LocationD(i,1)==1)*7+(LocationD(i,1)==2)*6+(LocationD(i,1)==3)*5+(LocationD(i,1)==4)*4+(LocationD(i,1)==5)*3+(LocationD(i,1)==6)*2+(LocationD(i,1)==7)*1+(LocationD(i,1)==8)*0:
                             distance8=14+i*1+width8:NEXT(12$);


;
;
;     Model statements for module:  Assign 10
;
8$            ASSIGN:        i=i+1:NEXT(218$);


;
;
;     Model statements for module:  Decide 228
;
218$          BRANCH,        1:
                             If,i<=289,346$,Yes:
                             Else,347$,Yes;
346$          ASSIGN:        Decide 228.NumberOut True=Decide 228.NumberOut True + 1:NEXT(13$);

347$          ASSIGN:        Decide 228.NumberOut False=Decide 228.NumberOut False + 1:NEXT(219$);


;
;
;     Model statements for module:  Assign 196
;
219$          ASSIGN:        stock exceeded=1:NEXT(214$);


;
;
;     Model statements for module:  Decide 227
;
214$          BRANCH,        1:
                             If,producttype==1,215$,Yes:
                             If,producttype==2,216$,Yes:
                             Else,217$,Yes;
217$          ASSIGN:        stock3=stock3+1:NEXT(53$);

215$          ASSIGN:        stock1=stock1+1:NEXT(53$);

216$          ASSIGN:        stock2=stock2+1:NEXT(53$);

176$          TALLY:         time in receiptq at d2,tnow-receiptqenter,1:NEXT(21$);


;
;
;     Model statements for module:  Assign 15
;
21$           ASSIGN:        truckcap=8:
                             dockno=2:NEXT(22$);

22$           DUPLICATE:     truckcap-1,69$:NEXT(69$);


;
;
;     Model statements for module:  Process 2
;
69$           ASSIGN:        Process 2.NumberIn=Process 2.NumberIn + 1:
                             Process 2.WIP=Process 2.WIP+1;
379$          STACK,         1:Save:NEXT(353$);

353$          QUEUE,         Process 2.Queue;
352$          SEIZE,         1,VA:
                             SELECT(TransSet5,SNB, ),1:NEXT(351$);

351$          DELAY:         SecondsToBaseTime(UNIF(62,83,62)),,VA:NEXT(394$);

394$          ASSIGN:        Process 2.WaitTime=Process 2.WaitTime + Diff.WaitTime;
358$          TALLY:         Process 2.WaitTimePerEntity,Diff.WaitTime,1;
360$          TALLY:         Process 2.TotalTimePerEntity,Diff.StartTime,1;
384$          ASSIGN:        Process 2.VATime=Process 2.VATime + Diff.VATime;
385$          TALLY:         Process 2.VATimePerEntity,Diff.VATime,1;
350$          RELEASE:       SELECT(TransSet5,LAST),1;
399$          STACK,         1:Destroy:NEXT(398$);

398$          ASSIGN:        Process 2.NumberOut=Process 2.NumberOut + 1:
                             Process 2.WIP=Process 2.WIP-1:NEXT(179$);


;
;
;     Model statements for module:  Assign 111
;
179$          ASSIGN:        beginning time for putaway from d2=tnow:NEXT(104$);

116$          COUNT:         receiptatruck,1:NEXT(110$);

118$          COUNT:         receiptbtruck,1:NEXT(110$);


;
;
;     Model statements for module:  Create 115
;

401$          CREATE,        1,NSEXPO(schedule for departure arrivals),departure:NSEXPO(schedule for departure arrivals)
                             :NEXT(402$);

402$          ASSIGN:        Create 115.NumberOut=Create 115.NumberOut + 1:NEXT(235$);


;
;
;     Model statements for module:  Assign 201
;
235$          ASSIGN:        type=disc(0.6,1,0.9,2,1,3):NEXT(97$);


;
;
;     Model statements for module:  Decide 115
;
97$           BRANCH,        1:
                             If,type==1,105$,Yes:
                             If,type==2,106$,Yes:
                             Else,107$,Yes;

;
;
;     Model statements for module:  Decide 120
;
107$          BRANCH,        1:
                             If,product3stock>=safety stock,407$,Yes:
                             Else,408$,Yes;
407$          ASSIGN:        Decide 120.NumberOut True=Decide 120.NumberOut True + 1:NEXT(161$);

408$          ASSIGN:        Decide 120.NumberOut False=Decide 120.NumberOut False + 1:NEXT(99$);

161$          COUNT:         dispatchctruck,1:NEXT(23$);


;
;
;     Model statements for module:  Assign 23
;
23$           ASSIGN:        ordersize=8:
                             shipmentqenter=tnow:NEXT(67$);

67$           ASSIGN:        product2stock=(type==2)*(product2stock-8)+(type<>2)*(product2stock-0):
                             product3stock=(type==3)*(product3stock-8)+(type<>3)*(product3stock-0):
                             product1stock=(type==1)*(product1stock-8)+(type<>1)*(product1stock-0);
109$          QUEUE,         shipmentdockqueue;
102$          SEIZE,         1,Other:
                             SELECT(S_docks,LRC,s_index),1:NEXT(103$);


;
;
;     Model statements for module:  Decide 117
;
103$          BRANCH,        1:
                             If,s_docks(s_index)==dock1,409$,Yes:
                             Else,410$,Yes;
409$          ASSIGN:        Decide 117.NumberOut True=Decide 117.NumberOut True + 1:NEXT(112$);

410$          ASSIGN:        Decide 117.NumberOut False=Decide 117.NumberOut False + 1:NEXT(177$);

112$          TALLY:         time in shipmentq at d1,tnow-shipmentqenter,1:NEXT(65$);


;
;
;     Model statements for module:  Assign 47
;
65$           ASSIGN:        dock_no=1:
                             leave the dock1 queue=tnow:NEXT(25$);

25$           DUPLICATE:     ordersize-1,24$:NEXT(24$);


;
;
;     Model statements for module:  Assign 24
;
24$           ASSIGN:        picked=0:
                             k=1:
                             totalstock=product1stock+product2stock+product3stock:
                             totalexceedingstock=stock1+stock2+stock3:NEXT(26$);

26$           WHILE:         (picked==0):NEXT(27$);


;
;
;     Model statements for module:  Decide 17
;
27$           BRANCH,        1:
                             If,( LocationA(k,1) <> 0  )  &&  ( type == LocationA(k,2) ),411$,Yes:
                             Else,412$,Yes;
411$          ASSIGN:        Decide 17.NumberOut True=Decide 17.NumberOut True + 1:NEXT(28$);

412$          ASSIGN:        Decide 17.NumberOut False=Decide 17.NumberOut False + 1:NEXT(32$);

28$           ASSIGN:        LocationA(k,1)=LocationA(k,1)-1:NEXT(29$);


;
;
;     Model statements for module:  Assign 27
;
29$           ASSIGN:        picked=1:
                             Locationtype=1:NEXT(30$);


;
;
;     Model statements for module:  Decide 18
;
30$           BRANCH,        1:
                             If,LocationA(k,1)==0,413$,Yes:
                             Else,414$,Yes;
413$          ASSIGN:        Decide 18.NumberOut True=Decide 18.NumberOut True + 1:NEXT(31$);

414$          ASSIGN:        Decide 18.NumberOut False=Decide 18.NumberOut False + 1:NEXT(62$);

31$           ASSIGN:        LocationA(k,2)=0:NEXT(62$);


;
;
;     Model statements for module:  Decide 57
;
62$           BRANCH,        1:
                             If,dock_no==1,415$,Yes:
                             Else,416$,Yes;
415$          ASSIGN:        Decide 57.NumberOut True=Decide 57.NumberOut True + 1:NEXT(63$);

416$          ASSIGN:        Decide 57.NumberOut False=Decide 57.NumberOut False + 1:NEXT(64$);


;
;
;     Model statements for module:  Assign 43
;
63$           ASSIGN:        width9=
                             (LocationA(k,1)==4)*0+(LocationA(k,1)==3)*1+(LocationA(k,1)==2)*2+(LocationA(k,1)==1)*3+(LocationA(k,1)==0)*4:
                             distance9=20+k*1+width9:NEXT(37$);

37$           ENDWHILE:NEXT(41$);


;
;
;     Model statements for module:  Decide 22
;
41$           BRANCH,        1:
                             If,dock_no==1,417$,Yes:
                             Else,418$,Yes;
417$          ASSIGN:        Decide 22.NumberOut True=Decide 22.NumberOut True + 1:NEXT(39$);

418$          ASSIGN:        Decide 22.NumberOut False=Decide 22.NumberOut False + 1:NEXT(49$);


;
;
;     Model statements for module:  Seize 9
;
39$           QUEUE,         Seize 9.Queue;
              SEIZE,         2,Other:
                             SELECT(TransSet3,CYC, trans_no3),1:NEXT(420$);

420$          DELAY:         0.0,,VA:NEXT(230$);


;
;
;     Model statements for module:  Decide 233
;
230$          BRANCH,        1:
                             If,departure from stock exceeded<>1,421$,Yes:
                             Else,422$,Yes;
421$          ASSIGN:        Decide 233.NumberOut True=Decide 233.NumberOut True + 1:NEXT(42$);

422$          ASSIGN:        Decide 233.NumberOut False=Decide 233.NumberOut False + 1:NEXT(231$);


;
;
;     Model statements for module:  Delay 5
;
42$           DELAY:         
                             SecondsToBaseTime((Locationtype==1)*((34.521+(0.915*distance9)+NORM(0,7.3))*2)+(Locationtype==2)*((34.521+(0.915*distance11)+NORM(0,7.3))*2)+(Locationtype==3)*((34.521+(0.915*distance13)+NORM(0,7.3))*2)+(Locationtype==4)*((34.521+(0.915*distance15)+NORM(0,7.3))*2)),,
                             Other:NEXT(86$);

86$           RELEASE:       Member(TransSet3, trans_no3),1;
187$          ASSIGN:        #product from d1=#product from d1+1:NEXT(126$);


;
;
;     Model statements for module:  Decide 123
;
126$          BRANCH,        1:
                             If,#product from d1==8,423$,Yes:
                             Else,424$,Yes;
423$          ASSIGN:        Decide 123.NumberOut True=Decide 123.NumberOut True + 1:NEXT(165$);

424$          ASSIGN:        Decide 123.NumberOut False=Decide 123.NumberOut False + 1:NEXT(195$);

165$          TALLY:         time for pickup to d1,tnow-leave the dock1 queue,1;
188$          ASSIGN:        #product from d1=#product from d1-#product from d1:NEXT(85$);


;
;
;     Model statements for module:  Process 5
;
85$           ASSIGN:        Process 5.NumberIn=Process 5.NumberIn + 1:
                             Process 5.WIP=Process 5.WIP+1;
454$          STACK,         1:Save:NEXT(428$);

428$          QUEUE,         Process 5.Queue;
427$          SEIZE,         1,VA:
                             SELECT(TransSet4,SNB, ),1:NEXT(426$);

426$          DELAY:         SecondsToBaseTime(UNIF(62,83,63)),,VA:NEXT(469$);

469$          ASSIGN:        Process 5.WaitTime=Process 5.WaitTime + Diff.WaitTime;
433$          TALLY:         Process 5.WaitTimePerEntity,Diff.WaitTime,1;
435$          TALLY:         Process 5.TotalTimePerEntity,Diff.StartTime,1;
459$          ASSIGN:        Process 5.VATime=Process 5.VATime + Diff.VATime;
460$          TALLY:         Process 5.VATimePerEntity,Diff.VATime,1;
425$          RELEASE:       SELECT(TransSet4,LAST),1;
474$          STACK,         1:Destroy:NEXT(473$);

473$          ASSIGN:        Process 5.NumberOut=Process 5.NumberOut + 1:
                             Process 5.WIP=Process 5.WIP-1:NEXT(155$);

155$          ASSIGN:        #loaded1=#loaded1+1:NEXT(45$);


;
;
;     Model statements for module:  Decide 38
;
45$           BRANCH,        1:
                             If,#loaded1==ordersize,476$,Yes:
                             Else,477$,Yes;
476$          ASSIGN:        Decide 38.NumberOut True=Decide 38.NumberOut True + 1:NEXT(43$);

477$          ASSIGN:        Decide 38.NumberOut False=Decide 38.NumberOut False + 1:NEXT(44$);


;
;
;     Model statements for module:  Release 13
;
43$           RELEASE:       dock1,1:NEXT(156$);

156$          ASSIGN:        #loaded1=#loaded1-#loaded1;
167$          TALLY:         time in system from d1 for shipment,tnow-shipmentqenter,1;
248$          WRITE,         tally d1 time in system:
                             tnow-shipmentqenter,tnow;
172$          COUNT:         # of trucks that are in system  more than 60 minutes from d1,(tnow-shipmentqenter)>60;
182$          COUNT:         # of trucks that are in system  more than 45 minutes from d1,(tnow-shipmentqenter)>45;
173$          COUNT:         #of trucks that are from d1,1;
185$          TALLY:         time for loading at d1,tnow-starting time of loading at d1,1:NEXT(44$);


;
;
;     Model statements for module:  Dispose 13
;
44$           ASSIGN:        Dispose 13.NumberOut=Dispose 13.NumberOut + 1;
478$          DISPOSE:       Yes;

195$          ASSIGN:        #product being loaded from d1=#product being loaded from d1+1:NEXT(197$);


;
;
;     Model statements for module:  Decide 219
;
197$          BRANCH,        1:
                             If,#product being loaded from d1==1,479$,Yes:
                             Else,480$,Yes;
479$          ASSIGN:        Decide 219.NumberOut True=Decide 219.NumberOut True + 1:NEXT(196$);

480$          ASSIGN:        Decide 219.NumberOut False=Decide 219.NumberOut False + 1:NEXT(198$);


;
;
;     Model statements for module:  Assign 177
;
196$          ASSIGN:        starting time of loading at d1=tnow:NEXT(85$);


;
;
;     Model statements for module:  Decide 220
;
198$          BRANCH,        1:
                             If,#product being loaded from d1==7,481$,Yes:
                             Else,482$,Yes;
481$          ASSIGN:        Decide 220.NumberOut True=Decide 220.NumberOut True + 1:NEXT(199$);

482$          ASSIGN:        Decide 220.NumberOut False=Decide 220.NumberOut False + 1:NEXT(85$);

199$          ASSIGN:        #product being loaded from d1=#product being loaded from d1-#product being loaded from d1:NEXT(85$);


;
;
;     Model statements for module:  Delay 17
;
231$          DELAY:         SecondsToBaseTime(((34.521+(0.915*averagedistance)+Norm(0,7.3))*2)),,Other:NEXT(86$);


;
;
;     Model statements for module:  Seize 12
;
49$           QUEUE,         Seize 12.Queue;
              SEIZE,         2,Other:
                             SELECT(TransSet6,CYC, trans_no6),1:NEXT(484$);

484$          DELAY:         0.0,,VA:NEXT(232$);


;
;
;     Model statements for module:  Decide 234
;
232$          BRANCH,        1:
                             If,departure from stock exceeded<>1,485$,Yes:
                             Else,486$,Yes;
485$          ASSIGN:        Decide 234.NumberOut True=Decide 234.NumberOut True + 1:NEXT(51$);

486$          ASSIGN:        Decide 234.NumberOut False=Decide 234.NumberOut False + 1:NEXT(233$);


;
;
;     Model statements for module:  Delay 8
;
51$           DELAY:         
                             SecondsToBaseTime((Locationtype==1)*((34.521+(0.915*distance10)+NORM(0,7.3))*2)+(Locationtype==2)*((34.521+(0.915*distance12)+NORM(0,7.3))*2)+(Locationtype==3)*((34.521+(0.915*distance14)+NORM(0,7.3))*2)+(Locationtype==4)*((34.521+(0.915*distance16)+NORM(0,7.3))*2)),,
                             Other:NEXT(52$);

52$           RELEASE:       Member(TransSet6, Trans_No6),1;
189$          ASSIGN:        #product from d2=#product from d2+1:NEXT(125$);


;
;
;     Model statements for module:  Decide 122
;
125$          BRANCH,        1:
                             If,#product from d2==8,487$,Yes:
                             Else,488$,Yes;
487$          ASSIGN:        Decide 122.NumberOut True=Decide 122.NumberOut True + 1:NEXT(166$);

488$          ASSIGN:        Decide 122.NumberOut False=Decide 122.NumberOut False + 1:NEXT(191$);

166$          TALLY:         time for pickup to d2,tnow-leave the dock2 queue,1;
190$          ASSIGN:        #product from d2=#product from d2-#product from d2:NEXT(76$);


;
;
;     Model statements for module:  Process 4
;
76$           ASSIGN:        Process 4.NumberIn=Process 4.NumberIn + 1:
                             Process 4.WIP=Process 4.WIP+1;
518$          STACK,         1:Save:NEXT(492$);

492$          QUEUE,         Process 4.Queue;
491$          SEIZE,         1,VA:
                             SELECT(TransSet5,SNB, ),1:NEXT(490$);

490$          DELAY:         SecondsToBaseTime(UNIF(62,83,64)),,VA:NEXT(533$);

533$          ASSIGN:        Process 4.WaitTime=Process 4.WaitTime + Diff.WaitTime;
497$          TALLY:         Process 4.WaitTimePerEntity,Diff.WaitTime,1;
499$          TALLY:         Process 4.TotalTimePerEntity,Diff.StartTime,1;
523$          ASSIGN:        Process 4.VATime=Process 4.VATime + Diff.VATime;
524$          TALLY:         Process 4.VATimePerEntity,Diff.VATime,1;
489$          RELEASE:       SELECT(TransSet5,LAST),1;
538$          STACK,         1:Destroy:NEXT(537$);

537$          ASSIGN:        Process 4.NumberOut=Process 4.NumberOut + 1:
                             Process 4.WIP=Process 4.WIP-1:NEXT(157$);

157$          ASSIGN:        #loaded2=#loaded2+1:NEXT(46$);


;
;
;     Model statements for module:  Decide 39
;
46$           BRANCH,        1:
                             If,#loaded2==ordersize,540$,Yes:
                             Else,541$,Yes;
540$          ASSIGN:        Decide 39.NumberOut True=Decide 39.NumberOut True + 1:NEXT(47$);

541$          ASSIGN:        Decide 39.NumberOut False=Decide 39.NumberOut False + 1:NEXT(48$);


;
;
;     Model statements for module:  Release 14
;
47$           RELEASE:       dock2,1:NEXT(158$);

158$          ASSIGN:        #loaded2=#loaded2-#loaded2;
168$          TALLY:         time in system from d2 for shipment,tnow-shipmentqenter,1;
249$          WRITE,         tally d2 time in system:
                             tnow-shipmentqenter,tnow;
174$          COUNT:         # of trucks that are in system  more than 60 minutes from d2,(tnow-shipmentqenter)>60;
183$          COUNT:         # of trucks that are in system  more than 45 minutes from d2,(tnow-shipmentqenter)>45;
175$          COUNT:         #of trucks that are from d2,1;
186$          TALLY:         time for loading at d2,tnow-starting time of loading at d2,1:NEXT(48$);


;
;
;     Model statements for module:  Dispose 14
;
48$           ASSIGN:        Dispose 14.NumberOut=Dispose 14.NumberOut + 1;
542$          DISPOSE:       Yes;

191$          ASSIGN:        #product being loaded from d2=#product being loaded from d2+1:NEXT(192$);


;
;
;     Model statements for module:  Decide 217
;
192$          BRANCH,        1:
                             If,#product being loaded from d2==1,543$,Yes:
                             Else,544$,Yes;
543$          ASSIGN:        Decide 217.NumberOut True=Decide 217.NumberOut True + 1:NEXT(184$);

544$          ASSIGN:        Decide 217.NumberOut False=Decide 217.NumberOut False + 1:NEXT(193$);


;
;
;     Model statements for module:  Assign 176
;
184$          ASSIGN:        starting time of loading at d2=tnow:NEXT(76$);


;
;
;     Model statements for module:  Decide 218
;
193$          BRANCH,        1:
                             If,#product being loaded from d2==7,545$,Yes:
                             Else,546$,Yes;
545$          ASSIGN:        Decide 218.NumberOut True=Decide 218.NumberOut True + 1:NEXT(194$);

546$          ASSIGN:        Decide 218.NumberOut False=Decide 218.NumberOut False + 1:NEXT(76$);

194$          ASSIGN:        #product being loaded from d2=#product being loaded from d2-#product being loaded from d2:NEXT(76$);


;
;
;     Model statements for module:  Delay 21
;
233$          DELAY:         SecondsToBaseTime(((34.521+(0.915*averagedistance)+Norm(0,7.3))*2)),,Other:NEXT(52$);


;
;
;     Model statements for module:  Assign 44
;
64$           ASSIGN:        width10=
                             (LocationA(k,1)==4)*0+(LocationA(k,1)==3)*1+(LocationA(k,1)==2)*2+(LocationA(k,1)==1)*3+(LocationA(k,1)==0)*4:
                             distance10=23+k*1+width10:NEXT(37$);


;
;
;     Model statements for module:  Decide 19
;
32$           BRANCH,        1:
                             If,( LocationB(k,1) <> 0 )  &&  ( type == LocationB(k,2) ),547$,Yes:
                             Else,548$,Yes;
547$          ASSIGN:        Decide 19.NumberOut True=Decide 19.NumberOut True + 1:NEXT(33$);

548$          ASSIGN:        Decide 19.NumberOut False=Decide 19.NumberOut False + 1:NEXT(77$);

33$           ASSIGN:        LocationB(k,1)=LocationB(k,1)-1:NEXT(34$);


;
;
;     Model statements for module:  Assign 30
;
34$           ASSIGN:        picked=1:
                             Locationtype=2:NEXT(35$);


;
;
;     Model statements for module:  Decide 21
;
35$           BRANCH,        1:
                             If,LocationB(k,1)==0,549$,Yes:
                             Else,550$,Yes;
549$          ASSIGN:        Decide 21.NumberOut True=Decide 21.NumberOut True + 1:NEXT(36$);

550$          ASSIGN:        Decide 21.NumberOut False=Decide 21.NumberOut False + 1:NEXT(208$);

36$           ASSIGN:        LocationB(k,2)=0:NEXT(208$);


;
;
;     Model statements for module:  Decide 225
;
208$          BRANCH,        1:
                             If,dock_no==1,551$,Yes:
                             Else,552$,Yes;
551$          ASSIGN:        Decide 225.NumberOut True=Decide 225.NumberOut True + 1:NEXT(209$);

552$          ASSIGN:        Decide 225.NumberOut False=Decide 225.NumberOut False + 1:NEXT(210$);


;
;
;     Model statements for module:  Assign 191
;
209$          ASSIGN:        width11=
                             (LocationB(k,1)==4)*0+(LocationB(k,1)==3)*1+(LocationB(k,1)==2)*2+(LocationB(k,1)==1)*3+(LocationB(k,1)==0)*4:
                             distance11=20+k*1+width11:NEXT(37$);


;
;
;     Model statements for module:  Assign 192
;
210$          ASSIGN:        width12=
                             (LocationB(k,1)==4)*0+(LocationB(k,1)==3)*1+(LocationB(k,1)==2)*2+(LocationB(k,1)==1)*3+(LocationB(k,1)==0)*4:
                             distance12=23+k*1+width12:NEXT(37$);


;
;
;     Model statements for module:  Decide 82
;
77$           BRANCH,        1:
                             If,( LocationC(k,1) <> 0 )  &&  ( type == LocationC(k,2) ),553$,Yes:
                             Else,554$,Yes;
553$          ASSIGN:        Decide 82.NumberOut True=Decide 82.NumberOut True + 1:NEXT(78$);

554$          ASSIGN:        Decide 82.NumberOut False=Decide 82.NumberOut False + 1:NEXT(92$);

78$           ASSIGN:        LocationC(k,1)=LocationC(k,1)-1:NEXT(79$);


;
;
;     Model statements for module:  Assign 53
;
79$           ASSIGN:        picked=1:
                             Locationtype=3:NEXT(80$);


;
;
;     Model statements for module:  Decide 83
;
80$           BRANCH,        1:
                             If,LocationC(k,1)==0,555$,Yes:
                             Else,556$,Yes;
555$          ASSIGN:        Decide 83.NumberOut True=Decide 83.NumberOut True + 1:NEXT(81$);

556$          ASSIGN:        Decide 83.NumberOut False=Decide 83.NumberOut False + 1:NEXT(82$);

81$           ASSIGN:        LocationC(k,2)=0:NEXT(82$);


;
;
;     Model statements for module:  Decide 84
;
82$           BRANCH,        1:
                             If,dock_no==1,557$,Yes:
                             Else,558$,Yes;
557$          ASSIGN:        Decide 84.NumberOut True=Decide 84.NumberOut True + 1:NEXT(83$);

558$          ASSIGN:        Decide 84.NumberOut False=Decide 84.NumberOut False + 1:NEXT(84$);


;
;
;     Model statements for module:  Assign 55
;
83$           ASSIGN:        width13=
                             (LocationC(k,1)==7)*0+(LocationC(k,1)==6)*1+(LocationC(k,1)==5)*2+(LocationC(k,1)==4)*3+(LocationC(k,1)==3)*4+(LocationC(k,1)==2)*5+(LocationC(k,1)==1)*6+(LocationC(k,1)==0)*7:
                             distance13=13+k*1+width13:NEXT(37$);


;
;
;     Model statements for module:  Assign 56
;
84$           ASSIGN:        width14=
                             (LocationC(k,1)==7)*0+(LocationC(k,1)==6)*1+(LocationC(k,1)==5)*2+(LocationC(k,1)==4)*3+(LocationC(k,1)==3)*4+(LocationC(k,1)==2)*5+(LocationC(k,1)==1)*6+(LocationC(k,1)==0)*7:
                             distance14=14+k*1+width14:NEXT(37$);


;
;
;     Model statements for module:  Decide 111
;
92$           BRANCH,        1:
                             If,( LocationD(k,1) <> 0 )  &&  ( type == LocationD(k,2) ),559$,Yes:
                             Else,560$,Yes;
559$          ASSIGN:        Decide 111.NumberOut True=Decide 111.NumberOut True + 1:NEXT(93$);

560$          ASSIGN:        Decide 111.NumberOut False=Decide 111.NumberOut False + 1:NEXT(38$);

93$           ASSIGN:        LocationD(k,1)=LocationD(k,1)-1:NEXT(94$);


;
;
;     Model statements for module:  Assign 77
;
94$           ASSIGN:        picked=1:
                             Locationtype=4:NEXT(95$);


;
;
;     Model statements for module:  Decide 112
;
95$           BRANCH,        1:
                             If,LocationD(k,1)==0,561$,Yes:
                             Else,562$,Yes;
561$          ASSIGN:        Decide 112.NumberOut True=Decide 112.NumberOut True + 1:NEXT(96$);

562$          ASSIGN:        Decide 112.NumberOut False=Decide 112.NumberOut False + 1:NEXT(211$);

96$           ASSIGN:        LocationD(k,2)=0:NEXT(211$);


;
;
;     Model statements for module:  Decide 226
;
211$          BRANCH,        1:
                             If,dock_no==1,563$,Yes:
                             Else,564$,Yes;
563$          ASSIGN:        Decide 226.NumberOut True=Decide 226.NumberOut True + 1:NEXT(212$);

564$          ASSIGN:        Decide 226.NumberOut False=Decide 226.NumberOut False + 1:NEXT(213$);


;
;
;     Model statements for module:  Assign 193
;
212$          ASSIGN:        width15=
                             (LocationD(k,1)==7)*0+(LocationD(k,1)==6)*1+(LocationD(k,1)==5)*2+(LocationD(k,1)==4)*3+(LocationD(k,1)==3)*4+(LocationD(k,1)==2)*5+(LocationD(k,1)==1)*6+(LocationD(k,1)==0)*7:
                             distance15=13+k*1+width15:NEXT(37$);


;
;
;     Model statements for module:  Assign 194
;
213$          ASSIGN:        width16=
                             (LocationC(k,1)==7)*0+(LocationC(k,1)==6)*1+(LocationC(k,1)==5)*2+(LocationC(k,1)==4)*3+(LocationC(k,1)==3)*4+(LocationC(k,1)==2)*5+(LocationC(k,1)==1)*6+(LocationC(k,1)==0)*7:
                             distance16=14+k*1+width16:NEXT(37$);


;
;
;     Model statements for module:  Assign 32
;
38$           ASSIGN:        k=k+1:NEXT(224$);


;
;
;     Model statements for module:  Decide 231
;
224$          BRANCH,        1:
                             If,k<=289,565$,Yes:
                             Else,566$,Yes;
565$          ASSIGN:        Decide 231.NumberOut True=Decide 231.NumberOut True + 1:NEXT(37$);

566$          ASSIGN:        Decide 231.NumberOut False=Decide 231.NumberOut False + 1:NEXT(229$);


;
;
;     Model statements for module:  Assign 197
;
229$          ASSIGN:        departure from stock exceeded=1:NEXT(225$);


;
;
;     Model statements for module:  Decide 232
;
225$          BRANCH,        1:
                             If,type==1,226$,Yes:
                             If,type==2,227$,Yes:
                             Else,228$,Yes;
228$          ASSIGN:        stock3=stock3-1:NEXT(41$);

226$          ASSIGN:        stock1=stock1-1:NEXT(41$);

227$          ASSIGN:        stock2=stock2-1:NEXT(41$);

177$          TALLY:         time in shipmentq at d2,tnow-shipmentqenter,1:NEXT(66$);


;
;
;     Model statements for module:  Assign 48
;
66$           ASSIGN:        dock_no=2:
                             leave the dock2 queue=tnow:NEXT(25$);


;
;
;     Model statements for module:  Record 32
;
99$           COUNT:         #runaway,1:NEXT(98$);


;
;
;     Model statements for module:  Dispose 21
;
98$           ASSIGN:        Dispose 21.NumberOut=Dispose 21.NumberOut + 1;
569$          DISPOSE:       Yes;


;
;
;     Model statements for module:  Decide 118
;
105$          BRANCH,        1:
                             If,product1stock>=safety stock,570$,Yes:
                             Else,571$,Yes;
570$          ASSIGN:        Decide 118.NumberOut True=Decide 118.NumberOut True + 1:NEXT(159$);

571$          ASSIGN:        Decide 118.NumberOut False=Decide 118.NumberOut False + 1:NEXT(99$);

159$          COUNT:         dispatchatruck,1:NEXT(23$);


;
;
;     Model statements for module:  Decide 119
;
106$          BRANCH,        1:
                             If,product2stock>=safety stock,572$,Yes:
                             Else,573$,Yes;
572$          ASSIGN:        Decide 119.NumberOut True=Decide 119.NumberOut True + 1:NEXT(160$);

573$          ASSIGN:        Decide 119.NumberOut False=Decide 119.NumberOut False + 1:NEXT(99$);

160$          COUNT:         dispatchbtruck,1:NEXT(23$);


;
;
;     Model statements for module:  Create 116
;

574$          CREATE,        1,HoursToBaseTime(0.0),Entity 1:HoursToBaseTime(1):NEXT(575$);

575$          ASSIGN:        Create 116.NumberOut=Create 116.NumberOut + 1:NEXT(236$);


;
;
;     Model statements for module:  ReadWrite 1
;
236$          WRITE,         hourlyutil:
                             TNOW,
                             FRQTIM(forklift1,1),
                             FRQTIM(forklift1,2),
                             FRQTIM(forklift1,4),
                             FRQTIM(forklift2,1),
                             FRQTIM(forklift2,2),
                             FRQTIM(forklift2,4),
                             FRQTIM(forklift3,1),
                             FRQTIM(forklift3,2),
                             FRQTIM(forklift3,4),
                             FRQTIM(forklift4,1),
                             FRQTIM(forklift4,2),
                             FRQTIM(forklift4,4),
                             FRQTIM(forklift5,1),
                             FRQTIM(forklift5,2),
                             FRQTIM(forklift5,4),
                             FRQTIM(forklift6,1),
                             FRQTIM(forklift6,2),
                             FRQTIM(forklift6,4),
                             FRQTIM(forklift7,1),
                             FRQTIM(forklift7,2),
                             FRQTIM(forklift7,4),
                             FRQTIM(forklift8,1),
                             FRQTIM(forklift8,2),
                             FRQTIM(forklift8,4),
                             nc(hour1#):NEXT(240$);


;
;
;     Model statements for module:  Record 33
;
240$          COUNT:         hour1#,1:NEXT(237$);


;
;
;     Model statements for module:  Dispose 32
;
237$          ASSIGN:        Dispose 32.NumberOut=Dispose 32.NumberOut + 1;
578$          DISPOSE:       Yes;


;
;
;     Model statements for module:  Create 117
;

579$          CREATE,        1,HoursToBaseTime(0),Entity 1:HoursToBaseTime(1):NEXT(580$);

580$          ASSIGN:        Create 117.NumberOut=Create 117.NumberOut + 1:NEXT(238$);


;
;
;     Model statements for module:  ReadWrite 2
;
238$          WRITE,         percentage of trucks that are more than 45 min:
                             tnow,
                             nc(# of trucks that are in system  more than 45 minutes from d1),
                             nc(#of trucks that are from d1),
                             nc(# of trucks that are in system  more than 45 minutes from d2),
                             nc(#of trucks that are from d2),
                             nc(receiptatruck),
                             nc(receiptbtruck),
                             nc(receiptctruck),
                             nc(dispatchatruck),
                             nc(dispatchbtruck),
                             nc(dispatchctruck),
                             nc(hour2#):NEXT(241$);


;
;
;     Model statements for module:  Record 34
;
241$          COUNT:         hour2#,1:NEXT(239$);


;
;
;     Model statements for module:  Dispose 33
;
239$          ASSIGN:        Dispose 33.NumberOut=Dispose 33.NumberOut + 1;
583$          DISPOSE:       Yes;


242$          CREATE,        1,TFIN::NEXT(243$);

243$          WRITE,         utilizationf7:
                             FSTAND(forklift7,1),FSTAND(forklift7,2),FSTAND(forklift7,4);
244$          DISPOSE:       No;


245$          CREATE,        1,TFIN::NEXT(246$);

246$          WRITE,         utilizationf8:
                             FSTAND(forklift8,1),FSTAND(forklift8,2),FSTAND(forklift8,4);
247$          DISPOSE:       No;









